<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>对象的简化写法</title>
  </head>
  <body>
    <script>
     /*  let name = "Alice";
      let age = 12;
      let foo = () => console.log("aaaa");

      let user = {
        name,
        age,
        foo,
      };

      console.log(user.name);
      console.log(user.age);
      user.foo(); */

/* 
      let user ={
          name: "alice",
          foo(){
              console.log(this.name);
          }
      } */

      user.foo();
    </script>
  </body>
</html>
